from pydantic import BaseModel

class IMSModulesBindingsBase(BaseModel):
    module: str
    entry: str
    call: str
    title: str
    do: str
    state: str
    direct: int
    url: str
    icon: str
    displayorder: int
    multilevel: bool
    parent: str

class IMSModulesBindingsCreate(IMSModulesBindingsBase):
    pass

class IMSModulesBindings(IMSModulesBindingsBase):
    eid: int

    class Config:
        orm_mode = True

class IMSModulesCloudBase(BaseModel):
    name: str
    application_type: int
    title: str
    title_initial: str
    logo: str
    version: str
    install_status: int
    account_support: int
    wxapp_support: int
    webapp_support: int
    phoneapp_support: int
    welcome_support: int
    main_module_name: str
    main_module_logo: str
    has_new_version: bool
    has_new_branch: bool
    is_ban: int
    lastupdatetime: int
    xzapp_support: bool
    cloud_id: int
    aliapp_support: bool
    baiduapp_support: bool
    toutiaoapp_support: bool
    buytime: int
    module_status: bool

class IMSModulesCloudCreate(IMSModulesCloudBase):
    pass

class IMSModulesCloud(IMSModulesCloudBase):
    id: int

    class Config:
        orm_mode = True

class ModulesBase(BaseModel):
    name: str
    application_type: int
    type: str
    title: str
    version: str
    ability: str
    description: str
    author: str
    url: str
    settings: int
    subscribes: str
    handles: str
    isrulefields: int
    issystem: int
    target: int
    iscard: int
    permissions: str
    title_initial: str
    wxapp_support: int
    welcome_support: int
    oauth_type: int
    webapp_support: int
    phoneapp_support: int
    account_support: int
    xzapp_support: int
    aliapp_support: int
    logo: str
    baiduapp_support: int
    toutiaoapp_support: int
    from_: str
    cloud_record: int
    sections: int

class ModulesCreate(ModulesBase):
    pass

class ModulesUpdate(ModulesBase):
    pass

class Modules(ModulesBase):
    mid: int

    class Config:
        orm_mode = True


class IMSModulesIgnoreBase(BaseModel):
    name: str
    version: str

class IMSModulesIgnoreCreate(IMSModulesIgnoreBase):
    pass

class IMSModulesIgnore(IMSModulesIgnoreBase):
    id: int

    class Config:
        orm_mode = True


class IMSModulesPluginBase(BaseModel):
    name: str | None = None
    main_module: str | None = None

class IMSModulesPluginCreate(IMSModulesPluginBase):
    pass

class IMSModulesPlugin(IMSModulesPluginBase):
    id: int

    class Config:
        orm_mode = True


class IMSModulesPluginRankBase(BaseModel):
    uniacid: int
    uid: int
    rank: int
    plugin_name: str
    main_module_name: str

class IMSModulesPluginRankCreate(IMSModulesPluginRankBase):
    pass

class IMSModulesPluginRank(IMSModulesPluginRankBase):
    id: int

    class Config:
        orm_mode = True


class IMSModulesRankBase(BaseModel):
    module_name: str
    uid: int
    rank: int
    uniacid: int

class IMSModulesRankCreate(IMSModulesRankBase):
    pass

class IMSModulesRank(IMSModulesRankBase):
    id: int

    class Config:
        orm_mode = True


class IMSModulesRecycleBase(BaseModel):
    name: str
    type: int
    account_support: bool
    wxapp_support: bool
    welcome_support: bool
    webapp_support: bool
    phoneapp_support: bool
    xzapp_support: bool
    aliapp_support: bool
    baiduapp_support: bool
    toutiaoapp_support: bool

class IMSModulesRecycleCreate(IMSModulesRecycleBase):
    pass

class IMSModulesRecycle(IMSModulesRecycleBase):
    id: int

    class Config:
        orm_mode = True
